export function useGoToElement() {
    function goToElement(toEl,n = 0) {
        let bridge = document.querySelector(toEl);
          let body = document.body;
          let height = -20;
          do {
            height += bridge.offsetTop;
            bridge = bridge.offsetParent;
          } while (bridge !== body)
          window.scrollTo({
            top: height - n,
            behavior: 'smooth'
          })
    }
  return goToElement;
}

export function isMobileDevice() {
  const userAgent = navigator.userAgent.toLowerCase();
  return /iphone|ipod|android|blackberry|opera mini|iemobile|mobile/i.test(userAgent);
}